<%--
  Created by IntelliJ IDEA.
  User: 18114
  Date: 2022/10/31
  Time: 9:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div align="center">
  <h1>修改电池信息页面</h1>
  <form action="PwbtyServlet?arr=4&id=${p.id}">
    <table border="1" style="background-color: slategrey">
      <tr>
        <td>车辆类型</td>
        <td><input type="text" name="carName" id="carName" value="${p.carName}"></td>
      </tr>
      <tr>
        <td>所属城市</td>
        <td><input type="text" name="cityName" id="cityName" value="${p.cityName}">
        </td>
      </tr>
      <tr>
        <td>使用单位</td>
        <td><input type="text" name="userName" id="userName" value="${p.userName}"></td>
      </tr>
      <tr>
        <td>压差报警值</td>
        <td><input type="text" name="pressureValue" id="pressureValue" value="${p.pressureValue}">
        </td>
      </tr>
      <tr>
        <td>
          报警时间
        </td>
        <td>
          <input type="text" name="time" id="time" value="${p.time}">
        </td>
      </tr>
      <tr>
        <td>操作</td>
        <td> <input type="button" value="修改" onclick="a()"></td>
      </tr>
    </table>
  </form>
</div>
</body>
<script src="js/jquery-3.1.1.min.js"/>
<script>
  function a(){
    if ($("carName").value=="" || $("cityName").value==""
            ||$("userName").value==""||$("pressureValue").value==""||$("time").value==""){
      alert('请输入完整')
    }else if(!isNaN($("pressureValue").value)){
      alert('压差报警值必须是数值')
    }else if (/^\d{4}-\d{2}-\d{2}$/.test($("time").value)){
      alert('时间类型必须是yyyy-MM-dd')
    }else {
      $("form").submit()
    }
  }
</script>


</html>
